From c0c6c877810844620f58e9893f9fa8a54ca80859 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 13 Feb 2019 08:40:13 -0500 Subject: [PATCH] stack: Avoid some ugly unrefs Instead of using the list model api that forces us to drop the ref, just work with the list we have. --- gtk/gtkstack.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/gtk/gtkstack.c b/gtk/gtkstack.c index 2030e919f5..633a5ae712 100644 --- a/gtk/gtkstack.c +++ b/gtk/gtkstack.c @@ -464,8 +464,7 @@ gtk_stack_pages_is_selected (GtkSelectionModel *model, GtkStackPrivate *priv = gtk_stack_get_instance_private (pages->stack); GtkStackPage *page; - page = GTK_STACK_PAGE (g_list_model_get_item (G_LIST_MODEL (model), position)); - g_object_unref (page); + page = g_list_nth_data (priv->children, position); return page == priv->visible_child; } @@ -484,8 +483,7 @@ gtk_stack_pages_select_item (GtkSelectionModel *model, GtkStackPrivate *priv = gtk_stack_get_instance_private (pages->stack); GtkStackPage *page; - page = GTK_STACK_PAGE (g_list_model_get_item (G_LIST_MODEL (model), position)); - g_object_unref (page); + page = g_list_nth_data (priv->children, position); set_visible_child (pages->stack, page, priv->transition_type, priv->transition_duration); -- 2.30.2